<?php
	include "../../public/commom/config.php";
	include "../lock1.php";	
?>

<!DOCTYPE html>
<html>
	
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
		<link rel="stylesheet" type="text/css" href="../public/css/index.css"/>
	</head>
	
	<body>
		<div id="main">
			<h1>联系方式</h1>
			<table class="table table-bordered">
				<thead>
					<tr><th>编号</th><th>用户名</th><th>姓名</th><th>地址</th><th>电话</th><th>邮箱</th></tr>
				</thead>
				<tbody>
					<?php
						if($_GET) {
							$tel = $_GET["tel"];
							
							$sql = "SELECT * FROM touch WHERE tel = $tel";
							$sql = "SELECT touch.*, user.username FROM touch LEFT JOIN user ON (touch.user_id = user.id) WHERE tel = '$tel'";
							
							$result = mysqli_query($conn, $sql);
							
							while($row = mysqli_fetch_array($result)) {
								echo "<tr>
										<td>" . $row["id"] . "</td>
										<td>" . $row["username"] . "</td>
										<td>" . $row["name"] . "</td>
										<td>" . $row["addr"] . "</td>
										<td>" . $row["tel"] . "</td>
										<td>" . $row["email"] . "</td>
									</tr>";
							}
							
							mysqli_close($conn);
						}
						
					?>
				</tbody>
			</table>
		</div>
	</body>
	
</html>